<form action="<?= JRoute::_( 'index.php?option=com_pbny' ); ?>" method="post" name="adminForm" >

<? $teams = array();
   if(isset($this->teams))
   $teams = $this->teams;
   
   $positions = array();
   if(isset($this->positions))
     $positions = $this->positions;
   

   $person_id    = null;
   $firstname    = null;
   $lastname     = null;
   $phone_number = null;
   $height       = null;
   $weight       = null;

   if(isset($this->person)){
     $person_id    = $this->person->id;
   $firstname    = $this->person->firstname;
   $lastname     = $this->person->lastname;
   $phone_number = $this->person->phone_number;
   $height       = $this->person->height;
   $weight       = $this->person->weight;
   }
   
   $player_id     = null;
   $team_id       = null;
   $jersey_number = null;
   $position_id   = null;
   
   if(isset($this->player)){
     $player_id     = $this->player->id;
   $team_id       = $this->player->team_id;
   $jersey_number = $this->player->jersey_number;
   $position_id   = $this->player->position_id;
   }
   
   $pic_id  = null;
   $pic     = null;
   $pic_url = null;
   
   if(isset($this->pic)){
   $pic_id  = $this->pic->id;
   $pic     = $this->pic;
   $pic_url = $this->pic->pic_url;
   }

?>
<label>PLAYER PROFILE:</label>
<fieldset>
  <table style="width:100%">
    <tbody>
      <tr>
        <td height="40"><?= JText::_('Firstname:') ?></td>
        <td>
          <input type="text" name="firstname" id="firstname" value="<?= $firstname ?>" size="40" />
        </td>
        <td rowspan="6" colspan="2">
          <img style="margin-left:90px" src="<?= PBNYHelper::getFlickrImageUrl($pic->flickr_id, 'small') ?>" width="230px" height="230px"/>
        </td>
      </tr>
      <tr>
        <td height="40"><?= JText::_('Lastname:') ?></td>
        <td>
          <input type="text" name="lastname" id="lastname" value="<?= $lastname ?>" size="40"/>
        </td>
      </tr>
      <tr>
        <td height="40"><?= JText::_('Phone #:') ?></td>
        <td>
          <input type="text" name="phone_number" id="phone_number" value="<?= $phone_number ?>" size="40"/>
        </td>
      </tr>
      <tr>
        <td height="40"><?= JText::_('Height:') ?></td>
        <td>
          <input type="text" name="height" id="height" value="<?= $height ?>" size="40"/>      
        </td>
      </tr>
      <tr>
        <td height="40"><?= JText::_('Weight:') ?></td>
        <td>
          <input type="text" name="weight" id="weight" value="<?= $weight ?>" size="40"/>
        </td>
      </tr>
      <tr>
        <td height="40"><?= JText::_('Team:') ?></td>
        <td>
          <?= JHTML::_('select.genericlist', $teams, 'team_id', null, 'id', 'name', $team_id); ?>      
        </td>
      </tr>
      <tr>
        <td height="40"><?= JText::_('Jersey #:') ?></td>
        <td>
          <input type="text" name="jersey_number" id="jersey_number" value="<?= $jersey_number ?>" size="40"/>
        </td>
        <td><?= JText::_('Photo URL:') ?></td>
        <td>
          <input type="hidden" name="pic" id="pic" value="<?= $pic ?>"/>
          <textarea name="pic_url" id="pic_url" rows="2" cols="40"><?= $pic_url ?></textarea>      
        </td>
      </tr>
      <tr>
        <td height="40"><?= JText::_('Position:') ?></td>
        <td>
          <?= JHTML::_('select.genericlist', $positions, 'position_id', null, 'id', 'position', $position_id); ?>
        </td>
      </tr>
      <tr>
        <td height="40" colspan="2"><input type="submit" value="Update"/></td>
      </tr>
    </tbody>
  </table>
</fieldset>

<input type="hidden" name="player_id" id="player_id" value="<?= $player_id ?>"/>
<input type="hidden" name="pic_id" id="pic_id" value="<?= $pic_id ?>"/>
<input type="hidden" name="person_id" id="person_id" value="<?= $person_id ?>"/>
<input type="hidden" name="view" value="profile" />
<input type="hidden" name="task" value="profile_save" />

</form>
